home *** CD-ROM | disk | FTP | other *** search
- Path: sn.no!usenet
- From: larsit@sn.no (Lars-Inge Tonnessen)
- Newsgroups: comp.lang.c++
- Subject: Re: Getting the system time and date
- Date: Mon, 22 Jan 1996 16:24:52 GMT
- Organization: SN Internett
- Message-ID: <4e0dm2$pv4@hasle.sn.no>
- References: <tate.1.002C7F92@netwest.com>
- NNTP-Posting-Host: stavanger2-ppp13.oslo.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- tate@netwest.com (Tate Griffin) wrote:
-
- >How do I get the current time and date from a PC using C++?
-
-
- You can use a lib that is called "time.h". Your compiler should
- contain it, as it's standard ANSI C.
-
-
-
- // Example by Lars-Inge Tonnessen 1996
-
- #include <time.h>
- .
- .
- .
-
- void main(void)
- {
-
- tm Times;
- cout <<asctime(&Times);
-
- }
-
-
- When you run the application, it should return:
-
- Sun Jan 21 21:25:16 1996
-
- Take a look at the "time.h" file. It contains allmost everything that
- has to do with the time and date.
-
- Lars-Inge Tonnessen
- larsit@sn.no
-
-
-